package com.ffapp.rainmonitorcustom.bean;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.ffapp.rainmonitorcustom.util.MyUtils;

import java.util.Date;

import my.TimeUtils;

public class ProjectListData extends BasisBean {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;


	/**
	 * project_id : 1
	 * title : AUCTUS1
	 * brief : 区块链wifi生态系统
	 * thumbnail : http://api.ukl.suncco.com/uploads/project_img/1/timg.jpg
	 * grade : A级
	 * hot_status : hot
	 * purchase_end_time : 1525881600
	 */


	public final static int STATUS_COMMING = 0,STATUS_DOING = 1,STATUS_FINISH = 2,STATUS_ALL = 10;

	private String project_id;
	private String title;
	private String brief;
	private String thumbnail;
	private String grade;
	private String hot_status;
	private String cover;
	private String web_address;
	@JSONField(name = "surplus_token")
	private String surplus;
	private long purchase_start_time ;
	private long purchase_end_time;
	private int status;
	private int is_like;
	private int show_sign;

	public String getProject_id() {
		return project_id;
	}

	public void setProject_id(String project_id) {
		this.project_id = project_id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBrief() {
		return brief;
	}

	public void setBrief(String brief) {
		this.brief = brief;
	}

	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	public String getGrade() {
		if(TextUtils.isEmpty(grade))return "暂未评级";
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	public String getHot_status() {
		return hot_status;
	}

	public boolean isHot(){
		if(TextUtils.isEmpty(hot_status))return false;
		return  hot_status.equals("hot");
	}

	public void setHot_status(String hot_status) {
		this.hot_status = hot_status;
	}

	public long getPurchase_end_time() {
		return purchase_end_time;
	}

	public void setPurchase_end_time(long purchase_end_time) {
		this.purchase_end_time = purchase_end_time;
	}

	public String getPurchase_end_timeStr(){
//		return  TimeUtils.getTimeLongToStrByFormat(purchase_end_time*1000,"yyyy/MM/dd HH:mm aa");
		return  TimeUtils.getTimeLongToStrByFormat(purchase_end_time*1000,"yyyy/MM/dd");
	}

	public boolean isFinish(){
			return  status == STATUS_FINISH;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public long getPurchase_start_time() {
		return purchase_start_time;
	}

	public void setPurchase_start_time(long purchase_start_time) {
		this.purchase_start_time = purchase_start_time;
	}

	public long getBeginTimeLeft(){
		return  purchase_start_time*1000-new Date().getTime();
	}
	public long getFinishTimeLeft(){
		return  purchase_end_time*1000-new Date().getTime();
	}

	public String getCover() {
//		return cover;
		return getCover600x300();
	}
	public String getCover600x300() {
		return MyUtils.getImageUrlBySize(cover,800,400);
	}

	public void setCover(String cover) {
		this.cover = cover;
	}

	public int getIs_like() {
		return is_like;
	}
	public boolean getIs_likeBoolean() {
		return is_like == 1;
	}

	public void setIs_like(int is_like) {
		this.is_like = is_like;
	}

	public String getWeb_address() {
		return web_address;
	}

	public void setWeb_address(String web_address) {
		this.web_address = web_address;
	}

	public void setSurplus(String surplus) {
		this.surplus = surplus;
	}
	public String getSurplus() {
		return surplus;
	}
	public boolean getSurplusEmptyBoolean() {
		if(TextUtils.isEmpty(surplus))return true;
		return false;
	}
	public boolean getSurplusZeroBoolean() {
		if(TextUtils.isEmpty(surplus))return true;
		if(surplus.equals("0"))return true;
		if(surplus.equals("0.00"))return true;
		return false;
	}

	public int getShow_sign() {
		return show_sign;
	}
	public boolean getShow_signBoolean() {
		return show_sign == 1;
	}

	public void setShow_sign(int show_sign) {
		this.show_sign = show_sign;
	}
}
